// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import babelpolyfill from 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import Echarts from 'echarts'
import VCharts from 'v-charts'
import axios from 'axios'
import 'element-ui/lib/theme-chalk/index.css'
import store from './store'
import Vuex from 'vuex'
import VueCookie from 'vue-cookie'
import infiniteScroll from 'vue-infinite-scroll'
// 引入公共api
import * as apis from '@/api/common/apis.js'
Vue.prototype.$apis = apis
Vue.prototype.$echarts = Echarts
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
//将对象转成序列
axios.defaults.transformRequest = [function (data) {
  let ret = ''
  for (let it in data) {
    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
  }
  return ret
}];
Vue.prototype.$http = axios
Vue.use(ElementUI)
Vue.use(VCharts)
Vue.use(Vuex)
Vue.use(VueCookie)
Vue.use(infiniteScroll)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})
